package com.xiaoshou.pojo;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "question", catalog = "market")
public class Question implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private String id;
	private Questiontype questiontype;
	private User user;
	private String questionname;
	private String createtime;
	private String updatetime;
	private List<Answers> answerses = new ArrayList<Answers>();
	private Set<Comment> comments = new HashSet<Comment>();
	private List<QuestionFilesRel> questionFilesRels = new ArrayList<QuestionFilesRel>();
	
	private String outtime;

	@Id
	@Column(name = "id", unique = true, nullable = false, length = 40)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "questiontypeid", nullable = false)
	public Questiontype getQuestiontype() {
		return this.questiontype;
	}

	public void setQuestiontype(Questiontype questiontype) {
		this.questiontype = questiontype;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userid", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "questionname", length = 100)
	public String getQuestionname() {
		return this.questionname;
	}

	public void setQuestionname(String questionname) {
		this.questionname = questionname;
	}

	@Column(name = "createtime", length = 45)
	public String getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}

	@Column(name = "updatetime", length = 45)
	public String getUpdatetime() {
		return this.updatetime;
	}

	public void setUpdatetime(String updatetime) {
		this.updatetime = updatetime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "question")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "question")
	public List<Answers> getAnswerses() {
		return answerses;
	}

	public void setAnswerses(List<Answers> answerses) {
		this.answerses = answerses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "question")
	public List<QuestionFilesRel> getQuestionFilesRels() {
		return questionFilesRels;
	}

	public void setQuestionFilesRels(List<QuestionFilesRel> questionFilesRels) {
		this.questionFilesRels = questionFilesRels;
	}

	@Transient
	public String getOuttime() {
		return outtime;
	}

	public void setOuttime(String outtime) {
		this.outtime = outtime;
	}

	
	
}